window.vkAsyncInit = function() {
VK.Observer.subscribe('auth.login', function(response) {
  window.location = baseURL + '/openapi/getdata.php';
});
VK.Observer.subscribe('auth.logout', function() {
  window.location = baseURL + '/openapi/';
  //console.log('logout');
});
VK.Observer.subscribe('auth.statusChange', function(response) {
  //console.log('statusChange');
});
VK.Observer.subscribe('auth.sessionChange', function(r) {
  //console.log('sessionChange');
});
VK.init({
  apiId: 2117003,
  nameTransportPath: '/openapi/xd_receiver.html'
});
VK.UI.button('vk_login');
};
(function() {
var el = document.createElement('script');
el.type = 'text/javascript';
el.src = 'http://vkontakte.ru/js/api/openapi.js';
el.async = true;
document.getElementById('vk_api_transport').appendChild(el);
}());